const faker = require('faker');

faker.locale = 'zh_CN';

// 数量预警
const invquantitys = [];
for (let i = 0; i < 20; i++) {
  invquantitys.push({
    id: faker.random.uuid(),
    name: `物料SKU名称${i}`,
    man: `制造商${i}`,
    spec: `规格${i}`,
    unit: `单位${i}`,
    cate: `类别${i}`,
    prop: `属性${i}`,
    level: `分级${i}`,
    storename: `仓库${i}`,
    storehouse: faker.random.uuid(),
    amount: Math.round(Math.random() * 100),
    lowerlimit: Math.round(Math.random() * 100),
    upperlimit: Math.round(Math.random() * 100)
  });
}
// 有效期预警
const invvaliditys = [];
for (let i = 0; i < 20; i++) {
  invvaliditys.push({
    id: faker.random.uuid(),
    name: `物料${i}`,
    man: `制造商${i}`,
    spec: `规格${i}`,
    unit: `单位${i}`,
    cate: `类别${i}`,
    prop: `属性${i}`,
    level: i,
    storename: `仓库${i}`,
    storehouse: faker.random.uuid(),
    sitename: Math.round(Math.random() * 100),
    batchno: faker.random.uuid(),
    validitydate: (new Date()).toLocaleDateString(),
    remaindays: Math.round(Math.random()),
    alertdays: Math.round(Math.random() * 100)
  });
}

const invquantitydetail = {
  qalertUsing: false,
  quantitySet: 0,
  globalUpperLimit: 100,
  globalLowerLimit: 10,
  quantityAllUp: 99,
  quantityAllDown: 9,
  quantitySingleUp: 98,
  quantitySingleDown: 8,
  quantityViewList: [{
    storeName: '仓库A',
    storePos: '仓位B',
    count: 78,
    upLimit: 100,
    downLimit: 10
  }],
  validityChecked: false,
  validityCount: 88
};

const invvaliditydetail = {
  globalLowerLimit: 10,
  globalUpperLimit: 300,
  qalertList: [{
    id: '4028818c6437c23f016437c3f8da0001',
    lowerLimit: 2,
    sku: '2c948a896435879301643591a5ba0000',
    status: 1,
    storeHouse: '无敌的库',
    type: 1,
    upperLimit: 30,
  }],
  qalertStorehouseMode: 0,
  qalertUsing: 1,
  sku: '2c948a896435879301643591a5ba0000',
  valertUsing: 1,
  valertdays: 2,
  vid: '4028fbf6628082140162808800a50000',
};

export default {
  getWarnCount: () => ({
    status: 0,
    obj: {
      qAlert: 1,
      vAlert: 2
    },
    comment: '成功'
  }),
  getQuantityList: () => ({
    status: 0,
    obj: {
      records: invquantitys,
      totalNum: 23,
    },
    comment: '成功'
  }),
  getValidityList: () => ({
    pageSize: 20,
    pageNum: 1,
    totalNum: 23,
    invvaliditys
  }),
  getAlertDetail: () => invquantitydetail,
  getAlertSet: () => invvaliditydetail
};
